import Vue from 'vue'
import axios from 'axios';
import App from './App.vue'
import router from './router'
import store from './store'

import 'mint-ui/lib/style.css'
import MintUI from 'mint-ui'
Vue.use(MintUI)


Vue.prototype.$axios = axios
axios.defaults.baseURL = process.env.VUE_APP_BASE_API;

Vue.config.productionTip = false


router.beforeEach((to, from, next) => {
  next()
});

(function (doc, win) {
  var docEl = doc.documentElement,
    resizeEvt =
      "orientationchange" in window ? "orientationchange" : "resize",
    recalc = function () {
      var clientWidth = docEl.clientWidth;
      if (!clientWidth) return;
      // 注意: Iphone6 和 IphoneX宽度一样 rem与px的比例一样 
      docEl.style.fontSize = 16 * (clientWidth / 375) + "px";

      console.log(docEl.style.fontSize);
      doc.body.style.width = docEl.clientWidth + "px";
      doc.body.style.height = docEl.clientHeight + "px";
    };
  if (!doc.addEventListener) return;
  win.addEventListener(resizeEvt, recalc, false); //addEventListener事件方法接受三个参数：第一个是事件名称比如点击事件onclick，第二个是要执行的函数，第三个是布尔值
  doc.addEventListener("DOMContentLoaded", recalc, false); // 绑定浏览器缩放与加载时间
  doc.body.style.width = docEl.clientWidth + "px";
  doc.body.style.height = docEl.clientHeight + "px";

})(document, window);




new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


